﻿using System;
using System.Data;

using Wicresoft.Common;

namespace Wicresoft.JDPostBoard.Entity
{
    [Table("GiftUnit", "", "JDPB.ConnectionString")]
    public class GiftUnit : Info
    {
        #region SQL column name consts
        public const string SQLCOL_ID = "ID";
        public const string SQLCOL_UNITNAME = "UnitName";
        public const string SQLCOL_CREATORID = "CreatorID";
        public const string SQLCOL_CREATORNAME = "CreatorName";
        public const string SQLCOL_CREATORDSNAME = "CreatorDsName";
        public const string SQLCOL_CREATETIME = "CreateTime";
        public const string SQLCOL_ISENABLE = "IsEnable";
        #endregion


        #region Contructors
        /// <summary>
        /// Construct empty entity
        /// </summary>
        public GiftUnit() { }

        /// <summary>
        /// Construct entity by primary key, other fields will be assigned by 
        /// "Load" method.
        /// </summary>
        public GiftUnit(Guid ID)
        {
            this.ID = ID;
        }
        #endregion

        public override void Init(DataRow row)
        {
            ID = (Guid)ObjectType.GuidTypeHelper.Read(row[SQLCOL_ID]);
            UnitName = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_UNITNAME]);
            CreatorID = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_CREATORID]);
            CreatorName = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_CREATORNAME]);
            CreatorDsName = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_CREATORDSNAME]);
            CreateTime = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_CREATETIME]);
            IsEnable = (bool)ObjectType.BooleanTypeHelper.Read(row[SQLCOL_ISENABLE]);
        }

        #region Properties
        #region Property <Guid> ID
        [Property("ID", 16, SqlDbType.UniqueIdentifier, false, true)]
        public Guid ID
        {
            get { return _ID; }
            set { _ID = value; }
        }
        private Guid _ID = Guid.Empty;
        #endregion

        #region Property <string> UnitName
        [Property("UnitName", 100, SqlDbType.NVarChar, false, false)]
        public string UnitName
        {
            get { return _UnitName; }
            set { _UnitName = value; }
        }
        private string _UnitName = null;
        #endregion

        #region Property <string> CreatorID
        [Property("CreatorID", 100, SqlDbType.NVarChar, false, false)]
        public string CreatorID
        {
            get { return _CreatorID; }
            set { _CreatorID = value; }
        }
        private string _CreatorID = null;
        #endregion

        #region Property <string> CreatorName
        [Property("CreatorName", 100, SqlDbType.NVarChar, false, false)]
        public string CreatorName
        {
            get { return _CreatorName; }
            set { _CreatorName = value; }
        }
        private string _CreatorName = null;
        #endregion

        #region Property <string> CreatorDsName
        [Property("CreatorDsName", 100, SqlDbType.NVarChar, false, false)]
        public string CreatorDsName
        {
            get { return _CreatorDsName; }
            set { _CreatorDsName = value; }
        }
        private string _CreatorDsName = null;
        #endregion

        #region Property <DateTime> CreateTime
        [Property("CreateTime", 16, SqlDbType.DateTime, false, false)]
        public DateTime CreateTime
        {
            get { return _CreateTime; }
            set { _CreateTime = value; }
        }
        private DateTime _CreateTime = DateTime.MinValue;
        #endregion

        #region Property <bool> IsEnable
        [Property("IsEnable", 1, SqlDbType.Bit, false, false)]
        public bool IsEnable
        {
            get { return _IsEnable; }
            set { _IsEnable = value; }
        }
        private bool _IsEnable = false;
        #endregion
        #endregion




    }
}
